# This is a sample Python script.

# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
import easyquotation

def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press ⌘F8 to toggle the breakpoint.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print_hi('PyCharm')
    quotation = easyquotation.use('sina') # 新浪 ['sina'] 腾讯 ['tencent', 'qq']

    #获取所有股票行情
    quotation.market_snapshot(prefix=True) # prefix 参数指定返回的行情字典中的股票代码 key 是否带 sz/sh 前缀

    #单只股票
    quotation.real('162411') # 支持直接指定前缀，如 'sh000001'
    print_hi(quotation.real('162411'))

    #多只股票
    quotation.stocks(['000001', '162411'])

    #同时获取指数和行情
    quotation.stocks(['sh000001', 'sz000001'], prefix=True)

